package com.example.demo2.service.impl;

import com.example.demo2.entity.Target;
import com.example.demo2.mapper.EvaluationContentMapper;
import com.example.demo2.mapper.TargetContentMapper;
import com.example.demo2.service.TargetService;
import com.example.demo2.mapper.TargetMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
//标记当前类是一个service类，加上该注解会将当前类自动注入到spring容器中，不需要再在applicationContext.xml文件定义bean了
public class TargetServiceImpl implements TargetService {

    @Autowired
    private TargetMapper targetMapper;
    @Autowired
    private TargetContentMapper targetContentMapper;
    @Autowired
    private EvaluationContentMapper evaluationContentMapper;
    @Override
    public Target queryTargetById(int courseTargetId) {
        return targetMapper.selectByPrimaryKey(courseTargetId);
    }

    @Override
    public int lv_insertTarget(Integer courseTargetId,Integer courseId,String courseTargetShortname,Integer bulumuTarget,String courseTargetContent)
    {
        return targetMapper.Lv_insertTarget(courseTargetId,courseId,courseTargetShortname,bulumuTarget,courseTargetContent);
    }
//    void lv_insertTarget();
    @Override
    public int Lv_deleteTargetById(Integer courseTargetId) {

       return targetMapper.Lv_deleteTargetById(courseTargetId);
    }

    @Override
    public List<Target> Lv_selectAllTarget() {
        return targetMapper.Lv_selectAllTarget();
    }

    @Override
    public int Lv_updateTarget(Target target) {
        return targetMapper.Lv_updateTarget(target);

    }

    @Override
    public List<Target> Lv_searchCourseTarget(String courseTargetShortname) {
        return targetMapper.Lv_searchCourseTarget(courseTargetShortname);
    }


    @Override
    public List<Target> findTargetContentById(Integer courseId) {
        return targetMapper.findTargetContentById(courseId);
    }

    @Override
    public int updateTeacheWayById(Integer courseId, Integer courseTargetNum, String teacheWay, String evaluationWay, String evaluationValue) {
        return targetMapper.updateTeacheWayById(courseId,courseTargetNum,teacheWay,evaluationWay,evaluationValue);
    }

    @Override
    public List<Target> findTargetAllById(Integer courseId) {
        return targetMapper.findTargetAllById(courseId);
    }

    @Override
    public List<Target> findTargetContentByName(String courseName) {
        return targetMapper.findTargetContentByName(courseName);
    }

    @Override
    public List<Target> findEvaluationWayById(Integer courseId) {
        return targetMapper.findEvaluationWayById(courseId);
    }

    @Override
    public int updateExamPointById(Integer courseId, Integer courseTargetNum, String examPoint) {
        return targetMapper.updateExamPointById(courseId,courseTargetNum,examPoint);
    }

    @Override
    public List<Target> findTargetContent(Integer courseId) {
        return targetContentMapper.findTargetContent(courseId);
    }

    @Override
    public int updateTargetContent(Integer courseId, String courseTarget, String courseTargetContent) {
        return targetContentMapper.updateTargetContent(courseId,courseTarget,courseTargetContent);
    }

    @Override
    public int deleteTargetContent(Integer courseId) {
        return targetContentMapper.deleteTargetContent(courseId);
    }

    @Override
    public List<Target> findEvaluationContent(Integer courseId) {
        return evaluationContentMapper.findEvaluationContent(courseId);
    }

    @Override
    public int deleteEvaluationContent(Integer courseId) {
        return evaluationContentMapper.deleteEvaluationContent(courseId);
    }

    @Override
    public int updateEvaluationContent(Integer courseId, String courseEvaluation, String courseEvaluationContent) {
        return evaluationContentMapper.updateEvaluationContent(courseId,courseEvaluation,courseEvaluationContent);
    }

}
